package com.作业.Day16;

import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Test2 {
    public static void main(String[] args) {
        String name = "text2.txt";
        String name1 = "text10.txt";
        try (BufferedReader bf = new BufferedReader(new FileReader(name));
             BufferedWriter bw = new BufferedWriter(new FileWriter(name1))
        ) {
            char[] chars = new char[1024];
            String len;
            List<String> s = new ArrayList<>();
            while ((len = bf.readLine()) != null) {
                s.add(len);
            }
            for (String i : s) {
                System.out.println(i);
            }
            /**
             * 进行排序
             */
            System.out.println("进行排序--------------------------");
            Collections.sort(s);
            for (String i : s) {
                bw.write(i);
                bw.newLine();
            }



        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
